package com.stars.common.base.entity;

import com.stars.common.base.BaseUUID;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Version;

/**
 * @author :dj
 * @version : 1.0.0
 * @description
 * @Date 2019-09-26 19:19
 * @note
 */
@Data
public class BasePropertyEntity extends BaseUUID {
    private static final long serialVersionUID = -5516534509168730828L;
    /**
     * 版本
     */
    @Version
    @Column(name = "VERSION")
    private Integer version;
    /**
     * 就否删除
     */
    @Column(name = "IS_DELETE")
    private Boolean isDelete;
    /**
     * 是否启用
     */
    @Column(name = "IS_ENABLE")
    private Boolean isEnable;

    public void versionAutoAdd() {
        if(null == this.getVersion()){
            this.setVersion(0);
        }
        this.setVersion(this.getVersion() + 1);
    }
}